<html>
<head>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="${ctx}/bootstrap/3.3.7/css/bootstrap.min.css" crossorigin="anonymous"/>
    <link href="${ctx}/font-awesome/3.0.0/css/font-awesome.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="${ctx}/css/index.css"/>
    <script src="${ctx}/jquery/2.1.4/jquery.min.js"></script>
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script
            src="${ctx}/bootstrap/3.3.7/js/bootstrap.min.js"
            integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
            crossorigin="anonymous"></script>
    <script src="${ctx}/js/iw.js"></script>

</head>
<style scoped>
    .control-label {
        width: 110px;
        padding: 0;
        text-align: right;
    }

    .form-group {
        display: flex;
    }

    .col-sm-9 {
        width: calc(100% - 120px);
        margin-left: 10px;
        padding: 0;
    }
</style>
<body class="container-fuild" style="padding: 8px 50px 0;">
<form class="form-horizontal" id="form">
    <input name="id" value="${afs.id!''}" type="hidden">
    <div class="form-group">
        <label for="size" class="col-sm-3 control-label">是否展示：</label>
        <div class="col-sm-9">
            <select class="form-control" id="exhibition" name="exhibition">
                <#list boolean as bl>
                    <option value="${bl}" <#if afs?? && afs.exhibition == bl>selected</#if>>${bl.title}</option>
                </#list>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label for="size" class="col-sm-3 control-label">跳转方向：</label>
        <div class="col-sm-9">
            <select class="form-control" id="direction" name="direction">
                <#list direction as dir>
                    <option value="${dir}" <#if afs?? && afs.direction == dir>selected</#if>>${dir.title}</option>
                </#list>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label for="title" class="col-sm-3 control-label">输入跳转地址：</label>
        <div class="col-sm-9">
            <input type="text" class="form-control" id="url" name="url" value="<#if afs??>${afs.url}</#if>"/>
        </div>
    </div>
    <div class="form-group">
        <label for="title" class="col-sm-3 control-label">悬浮窗图片：</label>
        <div class="col-sm-9">
            <input type="text" class="form-control" id="picture" name="picture"
                   value="<#if afs??>${afs.picture}</#if>"/>
        </div>
    </div>
    <div class="form-group">
        <label for="title" class="col-sm-3 control-label">类型：</label>
        <div class="col-sm-9">
            <input type="text" readonly class="form-control" id="category" name="category"
                   value="<#if afs??>${afs.category}</#if>"/>
        </div>
    </div>
    <div class="form-group">
        <label for="title" class="col-sm-3 control-label">名称：</label>
        <div class="col-sm-9">
            <input type="text" class="form-control" id="name" name="name" value="<#if afs??>${afs.name}</#if>"/>
        </div>
    </div>
</form>
<div class="col-xs-2" style="padding-left: 110px">
    <button class="btn btn-success" id="save_btn">保存</button>
</div>
<script>

    $(document).ready(function () {

        $("#save_btn").click(function () {
            if (confirm("是否修改保存？")) {
                $.ajax({
                    type: "post",
                    url: "/apps/saveFloatSwitch",
                    data: $("#form").serialize(),
                    success: function (res) {
                        alert("修改成功");
                        window.parent.iw.closeDialog();
                    }
                });
            }
        });
    });
</script>
</body>
</html>
